#include<16f877a.h>
//#device ADC=10
#include<stdio.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
//#use delay(clock=16000000)
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#define RF_A PIN_B0
#define RF_B PIN_B1
void main()
{
   unsigned char x_dir=0,wind;
   output_b(0xff);

   //row1();
   //display("HEART BEAT");
   setup_port_A(ALL_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   port_b_pullups(TRUE);

      while(1)
      {
         set_adc_channel(0);
         delay_us(20);
         x_dir=Read_ADC();

      printf("weight=%d\n\r",x_dir);
    //  delay_ms(100);
      if(x_dir>=116)
      {
      output_low(RF_A);

      }
      set_adc_channel(1);
      delay_us(20);
      wind=Read_ADC();
      printf("count=%d\n\r",wind);
      if(wind>=29)
      {
      output_low(RF_B);
      }
      delay_ms(2000);
      output_b(0xff);

      }

}
